
#include <iostream>

using namespace std;

class vir
{
public:
    virtual void test() = 0;
};

class vir_child : public vir
{
public:
    virtual void test()
    {
        cout << "vir_child: 重写了我就不是抽象" << endl;
    }
};

class parent
{
public:
    virtual void func()
    {
        cout << "成人：全票" << endl;
    }
};

class child1 : public parent
{
public:
    virtual void func()
    {
        cout << "儿童：半价" << endl;
    }
};

class child2 : public parent
{
public:
    void func()
    {
        cout << "军人：优先" << endl;
    }
};

void test1(parent& p)
{
    p.func();
}

void test2(vir& s)
{
    s.test();
}

int main()
{
    parent p;
    child1 c1;
    child2 c2;

    test1(p);
    test1(c1);
    test1(c2);
    
    vir_child v1;
    test2(v1);

    return 0;
}

